﻿from google.appengine.ext import webapp  
from google.appengine.ext import db
from google.appengine.ext.webapp import template
from google.appengine.ext import webapp
from xmlWs import *                                         
import os  
from utilities import *
from entities import * 
from google.appengine.api import users
 
class Main(webapp.RequestHandler):
    def get(self):
        #Utils.signin(self)
        
        hotapps = App.GetHotApp("",0)
        newapps = App.GetNewApp("",0)
        topfrees = App.GetTopApp("",1,0)
        toppaids = App.GetTopApp("",0,0)
        #user = users.User("longtdbk@gmail.com")
        #AppComment.Add("good game",3,335 ,user)
        #comment = AppComment.GetbyApp(335,1)
        sources = Source.Get()
        user = users.get_current_user()
        template_values = {
           
            'status': Utils.signin(self),
            'header': SiteMaster.Header(self,"topnav_home"),
            'footer': SiteMaster.Footer(),
            'css'   : SiteMaster.CSS(),
            'hotapps' : hotapps,
            'newapps' : newapps,
            'topfrees' : topfrees,
            'toppaids' : toppaids,
            'sources'  : sources,
            }
      
        path = os.path.join(os.path.dirname(__file__), '../templates/index.html')
        self.response.out.write(template.render(path, template_values))

        